package edu.qd.learn.newchapter.chapter03.relational.onetomany;

import java.util.Vector;

/**
 * @author 布衣
 */
public class Demo01 {

    public static void main(String[] args) {

        System.out.println("1 to m");
        //1
        Brand b = new Brand();
        b.setName("康师傅...");
        Vector<Product> ps = new Vector<>();
        b.setPs(ps);
        //2 1 to m
        Product p1 = new Product();
        p1.setSno(1001);
        p1.setName("康师傅矿泉水");
        ps.add(p1);

        Product p2 = new Product();
        p2.setSno(1002);
        p2.setName("康师傅方便面");
        ps.add(p2);


        System.out.println("n to 1");
        Brand b1 = new Brand();
        b1.setName("vivo");
        Brand b2 = new Brand();
        b2.setName("华为");
        Brand b3 = new Brand();
        b3.setName("小米");

        Product p11 = new Product();
        p11.setName("小米10");
        p11.setBrand(b3);

        Product p12 = new Product();
        p12.setName("小米14");
        p11.setBrand(b3);

    }

}
